<?php

use app\common\services\StaticServices;
use yii\helpers\Url;

?>

<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/tab_calendar.php', ['tab' => 'index']) ?>
<div class="panel-content">
  <table class="ui selectable celled table">
    <input type="hidden" name="_csrf" id='csrf' value="<?= Yii::$app->request->csrfToken ?>">
    <thead>
    <tr>
      <th>日期</th>
      <th>日期标签</th>
      <th>历史上的今天</th>
      <th>营销计划</th>
      <th>图片</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>

    <?php if ($list): ?>
      <?php foreach ($list as $item): ?>
        <tr>
          <td>
            <?= $item['date_value'] ?>
          </td>
          <td>
            <?= $item['data_name'] ?>
          </td>
          <td>
            <?= $item['history_today']?>
          </td>
          <td>
            <?= $item['marketing'] ?>
          </td>
          <td>
            <?= $item['image_url'] ?>
          </td>

          <td>
            <a href="<?= Url::to(['/admin/calendar/set', 'id' => $item['id']]) ?>"><i class="edit icon"></i></a>
            <a href="javascript:void (0)"><i class="trash alternate icon _del" data-id="<?= $item['id'] ?>"></i></a>
          </td>
        </tr>
      <?php endforeach; ?>
    <?php else: ?>
      <tr>
        <td colspan="4">暂无数据</td>
      </tr>
    <?php endif; ?>
    </tbody>

  </table>
</div>
<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/page.php', ['total_page' => $total_page, 'p' => $p, 'url' => '/admin/calendar/index']) ?>
<script type="text/javascript">
  require(['modules/calendar/index'], function (index) {
    index.cal_index();
  })
</script>